package xyz.zdsoft.homework_manage_module.Controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import xyz.zdsoft.common.utils.Result;
import xyz.zdsoft.homework_manage_module.Service.TeacherTaskService;
import xyz.zdsoft.homework_manage_module.bo.NewJob;
import xyz.zdsoft.homework_manage_module.bo.QueryJob;
import xyz.zdsoft.homework_manage_module.vo.JobType;
import xyz.zdsoft.homework_manage_module.vo.RestGroup;
import xyz.zdsoft.homework_manage_module.vo.RestStudent;
import xyz.zdsoft.homework_manage_module.vo.RestViewJob;


@Api(tags = "教师作业管理下发作业")
@RestController
@RequestMapping("/teacher/Task")
public class TeacherTaskController {
    @Autowired
    TeacherTaskService teacherTaskService;

    @ApiOperation("新增作业")
    @PostMapping("/NewJob")
    public Result NewJob(@RequestBody NewJob newJob){
        return teacherTaskService.NewJob(newJob);
    }

    @ApiOperation("查询作业")
    @PostMapping("/QueryJob")
    public Result QueryJob(@RequestBody QueryJob queryJob){
        return teacherTaskService.QueryJob(queryJob);
    }

    @ApiOperation("查看作业")
    @GetMapping ("/ViewJob/{id}")
    public Result<RestViewJob>  ViewJob(@PathVariable Integer id){
        return teacherTaskService.ViewJob(id);
    }

    @ApiOperation("删除作业作业")
    @DeleteMapping("/DeleteJob/{id}")
    public Result DeleteJob(@PathVariable Integer id){
        return teacherTaskService.DeleteJob(id);
    }

    @ApiOperation("新增作业选择课程下拉框")
    @PostMapping("/SelectCourse")
    public Result SelectCourse(){
        return teacherTaskService.SelectCourse();
    }
    @ApiOperation("新增作业选择类型下拉框")
    @PostMapping("/JobType")
    @ApiImplicitParam(name = "id",value = "课程id")
    public Result<JobType> JobType(Integer id){
        return teacherTaskService.JobType(id);
    }
    @ApiOperation("新增作业选择小组下拉框")
    @PostMapping("/SelectGroup")
    @ApiImplicitParam(name = "id",value = "课程id")
    public Result<RestGroup> SelectGroup(Integer id){
        return teacherTaskService.SelectGroup(id);
    }
    @ApiOperation("新增作业选择学生下拉框")
    @PostMapping("/SelectStudents")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "课程id"),
            @ApiImplicitParam(name = "teamId",value = "小组id")
    })
    public Result<RestStudent> SelectStudents(Integer id,Integer teamId){
        return teacherTaskService.SelectStudents(id,teamId) ;
    }

}
